<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
    <title>ShellCheck: SC2058 – Unknown unary operator.</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
  </head>
  <body style="margin-left: auto; margin-right: auto; max-width: 800px">
    <h1>SC2058 – ShellCheck Wiki</h1>
    <a href="https://github.com/koalaman/shellcheck/wiki/SC2058">See this page on GitHub</a>
    <p style="display: none"><a href="index.html">Sitemap</a></p>
    <hr />
    <h2 id="unknown-unary-operator">Unknown unary operator.</h2>
<h3 id="problematic-code">Problematic code:</h3>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="SC2058.html#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="bu">[</span> -E 42 <span class="bu">]</span></span></code></pre></div>
<h3 id="correct-code">Correct code:</h3>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="SC2058.html#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">[</span> <span class="ot">-e</span> 42 <span class="bu">]</span></span></code></pre></div>
<h3 id="rationale">Rationale:</h3>
<p>You are using an unknown unary operator in a <code>test</code>
expression. Perhaps it's a typo?</p>
<p>In bash, you can use <code>help test</code> to see a list of
supported operators:</p>
<pre><code>  -a FILE        True if file exists.
  -b FILE        True if file is block special.
  -c FILE        True if file is character special.
  -d FILE        True if file is a directory.
  -e FILE        True if file exists.
  -f FILE        True if file exists and is a regular file.
  -g FILE        True if file is set-group-id.
  -h FILE        True if file is a symbolic link.
  -L FILE        True if file is a symbolic link.
  -k FILE        True if file has its `sticky&#39; bit set.
  -p FILE        True if file is a named pipe.
  -r FILE        True if file is readable by you.
  -s FILE        True if file exists and is not empty.
  -S FILE        True if file is a socket.
  -t FD          True if FD is opened on a terminal.
  -u FILE        True if the file is set-user-id.
  -w FILE        True if the file is writable by you.
  -x FILE        True if the file is executable by you.
  -O FILE        True if the file is effectively owned by you.
  -G FILE        True if the file is effectively owned by your group.
  -N FILE        True if the file has been modified since it was last read.</code></pre>
<h3 id="exceptions">Exceptions:</h3>
<p>None. If you've tested and verified that the operator works but the
latest version of ShellCheck says it's unknown, please <a
href="https://github.com/koalaman/shellcheck/issues">submit a bug
report</a>.</p>
<h3 id="related-resources">Related resources:</h3>
<ul>
<li><a href="http://wiki.bash-hackers.org/commands/classictest">The
classic test command</a> on the Bash Hackers wiki.</li>
<li><a
href="http://wiki.bash-hackers.org/syntax/ccmd/conditional_expression">The
conditional expression</a> on the Bash Hackers wiki.</li>
<li><a
href="https://mywiki.wooledge.org/BashGuide/TestsAndConditionals">Tests
and conditionals</a> on the Wooledge BashGuide.</li>
</ul>
    <hr />
    <p style='font-size: 80%'><a href="../index.html">ShellCheck</a> is a static analysis tool for shell scripts. This page is part of its documentation.</p>
  </body>
</html>


